﻿using System.Collections.Generic;
using System.Web.Http;

namespace Shoy.MicroService
{
    public class UserController : ApiController
    {
        public class UserDto
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public string Avatar { get; set; }
        }

        [Route("user")]
        public UserDto Get(int id)
        {
            return new UserDto { Id = id, Avatar = $"avatar_{id}", Name = $"name_{id}" };
        }

        [HttpGet]
        [Route("user-list")]
        public List<UserDto> List()
        {
            var list = new List<UserDto>();
            for (var i = 0; i < 10; i++)
            {
                list.Add(new UserDto { Id = i, Avatar = $"avatar_{i}", Name = $"name_{i}" });
            }
            return list;
        }
    }
}
